﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteAlways]
public class CustomGUIRoot : MonoBehaviour
{
    CustomGUIController[] controllers;    
    void Start()
    {
        controllers = GetComponentsInChildren<CustomGUIController>();
    }

    private void OnGUI()
    {
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            controllers = GetComponentsInChildren<CustomGUIController>();
        }

        foreach (var controller in controllers)
        {
            controller.Draw();
        }
    }


}
